All Questions
15 questions
0votes
1answer
105views
Return multi-line ssh output to separate variables?
RHEL 8.10 OpenSSH_8.0p1, OpenSSL 1.1.1k FIPS 25 Mar 2021 As expected, this line (with two embedded commands) returns two rows: $ ssh -q remoteserver "ls -1 /proc/${p}/fd | wc -l ; ps -Ostate -p$...
9votes
1answer
600views
Why is bash startup executed under non-interactive ssh
I see an unexplained difference in behavior with ssh on Linux and FreeBSD, and it is the FreeBSD behavior that I would expect from the plain language of the manpages. So, something extra happens on ...
0votes
1answer
148views
Setting environmental variable in linux via ssh
I am working on three different issues so I have cloned source code in three different directories. 1) /nobackup/vivek/dev1/<source_code>.. 2) /nobackup/vivek/dev2/<source_code>.. 3) /...
0votes
2answers
96views
How do you reference env vars from the remote machine when running ssh command locally?
I want to execute a command on a remote server (Cent OS 7) and use the environment variables defined on that server. However, when I run this command ssh [email protected] "PGPASSWORD=$...
1vote
2answers
541views
This command: ". .bashrc" has resulted in: “-bash: /usr/bin/whoami: Argument list too long” whenever I try to execute any command
While following instructions at a forum post to install something over ssh at an external machine, I executed the following command without thinking: . .bashrc I have never seen the command before ...
0votes
2answers
484views
I sourced my .bashrc file and now get: “-bash: /usr/bin/whoami: Argument list too long” so that I can't execute any commands. Using ssh
I use an external HPC system via ssh. Today I tried to install "ASE" a Python code for dealing with atoms. I followed instructions to modify my .bashrc file but kept getting ...
4votes
1answer
11kviews
Passing env variables to a ssh connection
I want to pass enviromental variables to a ssh connection. They should be passed dynamically, therefore hard-coding them into the config file of ssh won't work for me. I've tried this: AAA="...
0votes
1answer
128views
In a bash script, how do I write a command for a remote machine using the remote machine's environment vars?
I'm trying to write a bash script on Ubuntu 18. I have the below script ... #!/bin/bash -l ssh myuser@remote-machine 'mysql -u $DB_USER --password=$DB_PASS $DB_NAME < /tmp/dump.sql' My primary ...
1vote
1answer
3kviews
Expand variables in local bash script before passing it to SSH
I am trying to execute a script on a remote host through SSH. The script uses environment variables that are set on the local shell. The variables in the script are not expanded. ssh user@host 'bash -...
0votes
1answer
3kviews
How to set environment variables for plink.exe?
plink is Windows executable, which connects by ssh and does some command on server side. For example plink myname@mycomputer ls will show result of ls command, being executed in the home directory ...
1vote
0answers
127views
Master environment script based on $LOGNAME to run on any shell invocation
Dealing with a nice list of Linux (and Solaris) servers, I find that 90% of my users need the same environment variables with a few specifics unique for an individual user. My goal is to eliminate ...
6votes
1answer
2kviews
How to safely transmit a password over SSH for a remote command to use
On the local server, I have a program that stores the password in the predefined environment variable (SPECIAL_PASSWORD). On the remote server I have a program that reads and uses a password from a ...
12votes
3answers
18kviews
Why do 'ssh host echo $PATH' and printing the $PATH after ssh'ing into the machine give different results?
On a particular host, when I ssh into the machine and enter echo $PATH I get /home/wxy/bin64:/home/wxy/bin:/usr/kerberos/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin and if I ...
13votes
2answers
19kviews
dot file not sourced when running a command via ssh
When I run my program interactively, it works fine: ssh somehost $ ~/some/path/somescript.py When I run my program over ssh directly, it doesn't work. The variable PYTHONPATH is not set, because ....
5votes
5answers
10kviews
ssh user@IP sh <command> missed environment variables
I use an approach ssh user@IP sh [runme.sh] to execute script remotely, this works fine. But I got one problem, that is in runme.sh, I can't get any envirnoment variables which are defined in ~/....